#define _CRT_SECURE_NO_WARNINGS 1


#include "List.h"
void test1()
{
	ListNode* plist = (ListNode*)malloc(sizeof(ListNode));
	ListInit(plist);

	ListPushBack(plist, 1);
	ListPushBack(plist, 2);
	ListPushBack(plist, 3);
	ListPushBack(plist, 4);
	ListPushBack(plist, 5);
	ListPrint(plist);

	ListPopBack(plist);
	ListPopBack(plist);
	ListPopBack(plist);
	ListPopBack(plist);



	ListPrint(plist);

	ListDestroy(plist);
	plist = NULL;
}


void test2()
{
	ListNode* plist = (ListNode*)malloc(sizeof(ListNode));
	ListInit(plist);
	ListPushFront(plist, 1);
	ListPushFront(plist, 2);
	ListPushFront(plist, 3);
	ListPushFront(plist, 4);
	ListPushFront(plist, 5);
	ListPrint(plist);

	ListNode* pos = ListFind(plist, 3);
	
	if (pos)
	{
		ListErase(pos);
	}
	ListPrint(plist);
	
	pos = ListFind(plist, 5);

	if (pos)
	{
		ListErase(pos);

	}
	ListPrint(plist);
	pos = ListFind(plist, 1);

	if (pos)
	{
		ListErase(pos);

	}
	ListPrint(plist);



	ListDestroy(plist);
	plist = NULL;
}


int main()
{
	//test1();
	test2();
	return 0;
}